<template>
  <div>
    <!-- 新增 -->
    <el-dialog
      title="新增"
      :visible.sync="dialogInfoFlag"
      width="580px"
      @close="handleClose"
    >
      <el-form :model="form" label-width="70px">
        <el-form-item label="类型：">
          <el-select v-model="form.region" placeholder="请选择">
            <el-option label="区域一" value="shanghai"></el-option>
            <el-option label="区域二" value="beijing"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="标题：">
          <el-input
            v-model="form.name"
            placeholder="请输入标题"
          ></el-input>
        </el-form-item>
        <el-form-item label="概况：">
          <el-input
            type="textarea"
            v-model="form.name"
            placeholder="请输入概况"
          ></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="handleClose">取消</el-button>
        <el-button type="primary">确定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: "dialogInfo",
  // 单向数据流 父级 ==> 子级 不能反向修改
  props: {
    flag: {
      type: Boolean,
      default: false
    }
  },
  components: {},
  data() {
    return {
      dialogInfoFlag: false,
      form: {
        name: "",
        region: "",
        date1: "",
        date2: "",
        delivery: false,
        type: [],
        resource: "",
        desc: ""
      }
    };
  },
  watch: {
    flag: {
      handler(newval) {
        this.dialogInfoFlag = newval;
      }
    }
  },
  created() {
  },
  mounted() {
  },
  methods: {
    handleClose() {
      this.dialogInfoFlag = false;
      this.$emit("update:flag", false);
      // 回调时需要做逻辑处理的时候，不可使用修饰器，反之可用
    }
  }
};
</script>

<style lang="scss" scoped>

</style>
